<template>
    <div class="newsInfo-container">
      <h1 class="title">{{newsinfo.title}}</h1>
      <p class="subtitle">
        <span>发表时间:{{newsinfo.add_time | dataFormat("YYYY-MM-DD HH:mm:ss")}}</span>
        <span>次数: {{newsinfo.click}}次</span>
      </p>
      <hr>

      <div class="container" v-html="newsinfo.content"></div>

      <!-- 评论区 -->
      <commt :id="this.id"></commt>
    </div>
</template>
<script>
import commt from '@/commt/comment.vue'
import { getnewsinfo } from "@/api/";
export default {
  data() {
    return {
        newsinfo:{},
        id:this.$route.params.id,
    };
  },
  created() {
    getnewsinfo(this.id).then(res => {
      this.newsinfo = res.data.message[0]
    });
    // console.log(this.$route)
  },
  components:{
      commt
  }
};
</script>

<style lang="less" scoped>
.newsInfo-container {
  padding: 0 4px;
  .title {
    text-align: center;
    font-size: 16px;
    margin: 16px 0;
    color: red;
  }
  .subtitle {
    font-size: 13px;
    color: #226aff;
    display: flex;
    justify-content: space-between;
  }

  .container {
    /deep/img {
      display: block;
      width: 100%;
    }
  }
}
</style>